package com.rockcent.mall.lib.repository;

import com.rockcent.mall.lib.domain.Merchant;
import com.rockcent.mall.lib.domain.enumclass.MerchantStatus;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;

import java.util.List;


/**
 * Created by oyhk on 14-6-22.
 *
 */
@Repository
public interface MerchantRepository extends JpaRepository<Merchant, Long>, JpaSpecificationExecutor,MerchantRepositoryCustomer {

    Merchant findByUserInfoIdAndMallId(Long userInfoId,Long mallId);

    Merchant findBySalesCode(String salesCode);

    Merchant findByIdAndMallId(Long id, Long id1);

    List<Merchant> findByIdIn(List<Long> merchantId);


    int countByMallIdAndStatus(Long mallId, MerchantStatus verified);

    Long countByName(String name);

    Merchant findByMallId(Long mallId);
}